package cn.edu.gdpt.mobile213.mobile2121606097wjc0501;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private RecyclerView rvMainStudent;
    private List<Student> list;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
        initData();
        rvMainStudent.setLayoutManager(new LinearLayoutManager(this));
        StudentRVAdapter adapter=new StudentRVAdapter(list);
        rvMainStudent.setAdapter(adapter);
    }

    private void initData() {
        list=new ArrayList<>();
        list.add(new Student("1910605001","小王","女","广东佛山"));
        list.add(new Student("1910605002","小杨","男","广东阳江"));
        list.add(new Student("1910605003","小吴","女","广东佛山"));
        list.add(new Student("1910605004","小梁","男","广东广州"));
        list.add(new Student("1910605005","小潘","女","广东佛山"));
        list.add(new Student("1910605006","小杨","男","广东深圳"));
        list.add(new Student("1910605007","小朱","男","广东佛山"));
    }

    private void initView() {
        rvMainStudent=(RecyclerView) findViewById(R.id.rvMainStudent);
    }
}